<template>
  <form id="form1">
    <div id="container">
  	<div class="content">
  	  <div class="tit">
  		<a>首页</a>&gt;
  		<a>会员信息</a>&gt;
  		<a>{{listQuery.type2 ? listQuery.type2 : "最新信息"}}</a>
  	  </div>
  	  <div class="news">
  		<div class="news_l">
  		  <div class="news_select">
          <select v-model="listQuery.type2" id="Member_Type" @change="fetchList">
            <option value="">全部</option>
            <option value="会员掠影">会员掠影</option>
            <option value="信息交流">信息交流</option>
            <option value="企业活动">企业活动</option>
          </select>
          <div class="sel">
            <input type="text" v-model="listQuery.key" id="newsKeyword" placeholder="请输入关键词" class="seltt">
            <input type="button" @click="fetchList()" value="搜索" id="bt_SearchNews" class="mit">
          </div>
  		  </div>
  		  <div class="newslist">
          <ul>
            <li v-for="item in list">
              <a :href="'/newsview?type=1&id=' + item.id">
                <div class="newstime">
                  <h2>{{item.createdTime.substring(8,10)}}</h2>
                  <span>{{item.createdTime.substring(0,4)}}/{{item.createdTime.substring(5,7)}}</span>
                </div>
                <div class="newstxt">
                  <h2>{{item.title}}</h2>
                  <p>{{item.contentTxt}}</p>
                  <span>
                  </span>
                </div>
              </a>
            </li>
          </ul>
  		  </div>
  		  <div class="divPage">
  			<div class="pages">
  			  <el-pagination
  			    style="text-align: center;"
  			    v-show="total>0"
  			    :total="total"
  			    :current-page.sync="listQuery.page"
  			    :page-size.sync="listQuery.size"
  			    layout="sizes,prev,slot,next,jumper"
  			    prev-text="上一页"
  			    next-text="下一页"
  			    @size-change="fetchList"
  			    @current-change="fetchList"
  			  >
  			    <span>{{listQuery.page}}/{{ Math.trunc((total+ listQuery.size-1) / listQuery.size)}}</span>
  			  </el-pagination>
  			</div>
  		  </div>
  		</div>
  		<div class="news_r">
  		  <div class="submenu">
  			<div class="suntit">会员信息</div>
          <ul>
            <li :class="listQuery.type2 == sub.label ? 'current': ''"
              v-for="sub in subMenus">
              <a :href="sub.url">
                <p>{{sub.label}}</p>
              </a>
            </li>
          </ul>
  		  </div>
        <!-- 推荐招标 -->
        <div class="zhaobiao">
          <a>
            <img src="https://kancha-1258911605.cos.ap-guangzhou.myqcloud.com/front/zhaobiao.jpg">
          </a>
        </div>
        <!-- 推荐招标 -->
  		</div>
  	  </div>
  	</div>
    </div>
  </form>
</template>

<script>
import Data from '@/api/data'

export default {
  name: 'Index',
  props:{
    layout: String
  },
  data() {
    return {
      subMenus: [
        {label:"会员展示", url:"/news7"},
        {label:"会员掠影", url:"/news8?type2="+encodeURIComponent("会员掠影")},
        {label:"信息交流", url:"/news8?type2="+encodeURIComponent("信息交流")},
        {label:"企业活动", url:"/news8?type2="+encodeURIComponent("企业活动")},
      ],
      list:[],
      total:0,
      listQuery: {
        page: 1,
        size: 10,
        status: "NORMAL",
        type1:"会员信息",
        type2:"",
        key: '',
      }
    }
  },
  watch: {
    month: {

    }

  },
  computed: {
  },
  created() {
    this.listQuery.type2 = this.$route.query.type2
    this.fetchList()
  },
  methods: {
    async fetchList() {
      console.log("请求参数",this.listQuery)
      const res = await Data.get("/article", this.listQuery)
      if (res) {
        this.list = res.list
        this.total = res.total
      }
    },

  }
}
</script>

<style lang="scss" scoped>
@import "~@/styles/new_files/bootstrap.min.css";
@import "~@/styles/new_files/iconfont.css";
@import "~@/styles/new_files/comm.css";
@import "~@/styles/new_files/info.css";
</style>
